<include file="public@header"/>
<link rel="stylesheet" href="/themes/admin_simpleboot3/admin/order/css/order.css">
</head>
<body>
<div class="wrap js-check-wrap">
    <div class="ns-main">


        <div class="mod-table">
            <div class="step-region clearfix">
                <div class="info-region">
                    <div class="info-div">订单信息<span class="secured-title">担保交易</span></div>
                    <table class="info-table">
                        <tbody>
                        <tr><th>订单编号：</th><td>{$orders_info.order_no}</td></tr>
                        <tr style="display: table-row;"><th>订单类型：</th><td><eq name="orders_info.order_type" value="0">商品订单</eq></td></tr>
                        <notempty name="orders_info.payment_type">
                            <tr><th>付款方式：</th><td>
                                <eq name="orders_info.payment_type" value="WEIXIN">微信支付</eq>
                                <eq name="orders_info.payment_type" value="ALIPAY">支付宝支付</eq>
                                </td>
                            </tr>
                        </notempty>
                        <tr><th>买家：</th><td><span>{$orders_info.user_name}</span></td></tr>
                        <tr><th>买家ip：</th><td><span>{$orders_info.buyer_ip}</span></td></tr>
                        </tbody>
                    </table>
                    <table class="info-table">
                        <tbody>
                        <tr><th>买家留言：</th><td>{$orders_info.leavemessage|default="无"}</td></tr>
                        <tr><th>是否开发票：</th><td><eq name="orders_info.is_invoice" value="0">否</eq><eq name="orders_info.is_invoice" value="1">是</eq></td></tr>
                        <tr><th>发票信息：</th>
                            <td>
                                <eq name="orders_info.is_invoice" value="0">无</eq>
                                <eq name="orders_info.is_invoice" value="1">
                                    <eq name="orders_info.invoice_type" value="0">个人</eq>
                                    <eq name="orders_info.invoice_type" value="1">
                                        {$orders_info.invoice_name}<br>{$orders_info.invoice_code}
                                    </eq>
                                </eq>
                            </td>
                        </tr>
                        <tr><th>关联店铺：</th><td>{$orders_info.store.store_name|default="无"}</td></tr>

                        </tbody>
                    </table>
                    <table class="info-table">
                        <tbody>
                        <tr><th>收货人姓名：</th><td>{$orders_info.receiver_name}</td></tr>
                        <tr><th>收货人手机：</th><td>{$orders_info.receiver_mobile}</td></tr>
                        <tr><th>收货人地址：</th><td>{:get_city_info($orders_info['receiver_province'],$orders_info['receiver_city'],$orders_info['receiver_district'])}{$orders_info.receiver_address}</td></tr>
                        </tbody>
                    </table>
                </div>

            </div>
            <table class="ui-table ui-table-simple goods-table order-detail-goods-table">
                <thead>
                <tr>
                    <th style="width:8%;">商品图</th>
                    <th class="cell-10" style="width:40%;">商品</th>
                    <th style="width:10%;">价格(元)</th>
                    <th style="width:10%;">数量</th>
                    <th class="cell-13" style="width:10%;">小计(元)</th>
                </tr>
                </thead>
                <tbody>
                <!-- 待发货商品 -->

                <foreach name="orders_info['order_goods']" item="vo">
                    <php>$photo=json_decode($vo['goods_picture'],true);</php>
                    <tr class="test-item">
                        <td class="td-goods-image" rowspan="1">
                            <div class="ui-centered-image" style="width: 48px; height: 48px;">
                                <img src="{:cmf_get_image_preview_url($photo.thumbnail)}" style="max-width: 48px; max-height: 48px;">
                            </div>
                        </td>
                        <td class="cell-10" style="width:200px;">
                            {$vo.goods_name}
                            <p class="c-gray"></p>
                        </td>
                        <td><span>￥<b>{$vo.price}</b>+{$vo.point}积分</span></td>
                        <td>{$vo.num}</td>
                        <td><span>￥<b>{$vo.price*$vo.num}</b>+{$vo.point*$vo.num}积分</span></td>
                    </tr>

                </foreach>
                <!-- 已发货 -->
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="9" class="text-right price">
                       <span>运费:</span><span>￥{$orders_info.shipping_money}</span>
                       <span>积分抵扣:</span><span>-{$orders_info.pay_point}</span>
                        <php>
                            $goods_money=$orders_info['goods_money']+$orders_info['shipping_money'];
                            $goods_money= number_format($goods_money, 2, '.', '');
                        </php>
                        <span>应付:</span><span style="color: red;">￥{$goods_money}+{$orders_info.goods_point}积分</span>
                        <span>实付:</span><span style="color: red;">￥{$orders_info.pay_money}+{$orders_info.pay_point}积分</span>
                    </td>
                </tr>
                </tfoot>
            </table>

            <table class="ui-table ui-table-simple goods-table order-detail-goods-table" style="border-top:none;">
            <thead>
            <tr>
                <th>订单状态</th>
                <th style="text-align: right; color: red;">{:cmf_get_order_status($orders_info.order_status)}</th>
            </tr>
            </thead>
            <tbody>
            <tr class="test-item">
                <td class="td-goods-image" colspan="9">
                    下单时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['create_time'])}
                </td>
            </tr>
            <notempty name="orders_info['pay_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        付款时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['pay_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['consign_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        发货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['consign_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['get_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        收货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['get_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['finish_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        完成时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['finish_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['refund_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        退换货申请时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['refund_time'])}
                    </td>
                </tr>
            </notempty>

            <notempty name="orders_info['refund_userfahuo_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        退换货用户发货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['refund_userfahuo_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['refund_storeget_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        退换货商家收货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['refund_storeget_time'])}
                    </td>
                </tr>
            </notempty>
            <notempty name="orders_info['refund_storefahuo_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        退换货商家发货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['refund_storefahuo_time'])}
                    </td>
                </tr>
            </notempty>


            <notempty name="orders_info['refund_userget_time']">
                <tr class="test-item">
                    <td class="td-goods-image" colspan="9">
                        退换货用户收货时间：&nbsp;&nbsp;&nbsp;{:date('Y-m-d H:i:s',$orders_info['refund_userget_time'])}
                    </td>
                </tr>
            </notempty>

            </tbody>
        </table>
            <notempty name="orders_info['shipping']">
            <table class="ui-table ui-table-simple goods-table order-detail-goods-table" style="border-top:none;">
                <thead>
                <tr>
                    <th>物流信息</th>
                    <th style="text-align:  right;"><a href="/admin/order/shipping/code/{$orders_info['shipping_code']}" data="">三方查询</a></th>
                </tr>
                </thead>
                <tbody>
                <php>

                    $Traces=json_decode($orders_info['shipping']['shipping_info'],true);
                 if($Traces['resultcode']=='200'){
                </php>
                <foreach name="Traces['result']['list']" item="vo">
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9">
                            {$vo.datetime}：&nbsp;&nbsp;&nbsp;{$vo.remark}
                        </td>
                    </tr>
                </foreach>
                  <php>}else{</php>                  
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9">
                            获取失败，原因：{$Traces['reason']};
                        </td>
                    </tr>            
                   <php>}</php>


                </tbody>
            </table>
            </notempty>
            <php>if($orders_info['refund_status']==1){ </php>


                <table class="ui-table ui-table-simple goods-table order-detail-goods-table" style="border-top:none;">
                    <thead>
                    <tr>
                        <th>退换货信息</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9"> 退换货类型：&nbsp;&nbsp;&nbsp;<eq name="orders_info['refund_type']" value="2">换货</eq><eq name="orders_info['refund_type']" value="1">退货</eq>   </td>
                    </tr>
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9"> 退换货金额：&nbsp;&nbsp;&nbsp;￥{$orders_info['refund_require_money']}+{$orders_info['refund_require_score']}积分  </td>
                    </tr>
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9"> 退换货原因：&nbsp;&nbsp;&nbsp;{$orders_info['refund_reason']} </td>
                    </tr>
                    <notempty name="orders_info['refund_no_reason']">
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9"> 退换货拒绝原因：&nbsp;&nbsp;&nbsp;{$orders_info['refund_no_reason']} </td>
                    </tr>
                    </notempty>
                    <tr class="test-item">
                        <td class="td-goods-image" colspan="9"> 退换货图片：&nbsp;&nbsp;&nbsp;
                            <php>
                                $imgs=json_decode($orders_info['refund_img'],true);
                            </php>
                            <foreach name="imgs" item="v">
                                <php>if($v){</php>
                                <a href="{$v}" target="_blank"><img src="{$v}"style="margin-right: 5px;width: 135px;"></a>
                                <php>}</php>
                            </foreach>
                        </td>
                    </tr>
                    <notempty name="orders_info['refund_user_shipping_code']">
                        <tr class="test-item">
                            <td class="td-goods-image" colspan="9"> 用户退货物流：&nbsp;&nbsp;&nbsp;{:get_logistics($orders_info['refund_user_shipping_company'])} </td>
                        </tr>
                        <tr class="test-item">
                            <td class="td-goods-image" colspan="9"> 用户退货物流单号：&nbsp;&nbsp;&nbsp;{$orders_info['refund_user_shipping_code']}  <a href="/admin/order/shipping/code/{$orders_info['refund_user_shipping_code']}" data="">【三方查询】</a> </td>
                        </tr>
                    </notempty>
                      <notempty name="orders_info['refund_shipping_code']">
                        <tr class="test-item">
                            <td class="td-goods-image" colspan="9"> 商户退货物流：&nbsp;&nbsp;&nbsp;{:get_logistics($orders_info['refund_shipping_company'])} </td>
                        </tr>
                        <tr class="test-item">
                            <td class="td-goods-image" colspan="9"> 商户退货物流单号：&nbsp;&nbsp;&nbsp;{$orders_info['refund_shipping_code']}  <a href="/admin/order/shipping/code/{$orders_info['refund_shipping_code']}" data="">【三方查询】</a> </td>
                        </tr>
                    </notempty>
                    </tbody>
                </table>

            <php>}</php>
         </div>
        <div style="float: right;margin: 10px 0 0 0;">
            <eq name="orders_info['order_status']" value="0"> </eq>
            <eq name="orders_info['order_status']" value="1">
                <form class="form-inline margin-top-20 js-ajax-form" method="post" action="/admin/order/logistics_edit.html">
                    物流公司:
                    <select class="form-control" name="shipping_company_id" style="width: 140px;">
                        <foreach name="Logistics_list" item="vo">
                        <option value="{$vo.id}">{$vo.logistics_name}</option>
                        </foreach>
                    </select>
                    订单号:
                    <input type="text" class="form-control" name="shipping_code" style="width: 200px;" value="{$orders_info['shipping_code']}" placeholder="请输入订单号...">
                    <button type="submit" class="btn btn-primary js-ajax-submit">发货</button>
                    <input type="hidden" name="order_id" value="{$orders_info['order_id']}">
                </form>

            </eq>
            <eq name="orders_info['order_status']" value="2">
                <form class="form-inline margin-top-20 js-ajax-form" method="post" action="/admin/order/logistics_edit.html">
                    物流公司:
                    <select class="form-control" name="shipping_company_id" style="width: 140px;">
                        <foreach name="Logistics_list" item="vo">
                            <option value="{$vo.id}" <eq name="orders_info.shipping_company_id" value="$vo['id']">selected</eq>>{$vo.logistics_name}</option>
                        </foreach>
                    </select>
                    订单号:
                    <input type="text" class="form-control" name="shipping_code" style="width: 200px;" value="{$orders_info['shipping_code']}" placeholder="请输入订单号...">
                    <button type="submit" class="btn btn-primary js-ajax-submit">更新发货</button>
                    <input type="button" class="btn btn-danger update_shipping" value="更新物流">
                    <input type="hidden" name="order_id" value="{$orders_info['order_id']}">
                </form>
            </eq>

            <eq name="orders_info['order_status']" value="3"></eq>
            <eq name="orders_info['order_status']" value="4"> </eq>
            <eq name="orders_info['order_status']" value="5">
                <a href="javascript:;" class="btn btn-info store_yes">同意</a>
                <a href="javascript:;" class="btn btn-danger store_no">拒绝</a>
            </eq>
            <eq name="orders_info['order_status']" value="6"></eq>
            <eq name="orders_info['order_status']" value="7"></eq>
            <eq name="orders_info['order_status']" value="8">
                <a href="javascript:;" class="btn btn-info return_get">确认收货</a>
            </eq>
            <eq name="orders_info['order_status']" value="9">
                <form class="form-inline margin-top-20 js-ajax-form" method="post" action="/admin/order/logistics_edit2.html">
                    物流公司:
                    <select class="form-control" name="refund_shipping_company" style="width: 140px;">
                        <foreach name="Logistics_list" item="vo">
                            <option value="{$vo.logistics_code}" <eq name="orders_info.refund_shipping_company" value="$vo['logistics_code']">selected</eq>>{$vo.logistics_name}</option>
                        </foreach>
                    </select>
                    订单号:
                    <input type="text" class="form-control" name="refund_shipping_code" style="width: 200px;" value="{$orders_info['refund_shipping_code']}" placeholder="请输入物流订单号...">
                    <button type="submit" class="btn btn-primary js-ajax-submit">立即发货</button>
                    <input type="hidden" name="order_id" value="{$orders_info['order_id']}">
                </form>
            </eq>
            <eq name="orders_info['order_status']" value="10">
                <form class="form-inline margin-top-20 js-ajax-form" method="post" action="/admin/order/logistics_edit2.html">
                    物流公司:
                    <select class="form-control" name="refund_shipping_company" style="width: 140px;">
                        <foreach name="Logistics_list" item="vo">
                            <option value="{$vo.logistics_code}" <eq name="orders_info.refund_shipping_company" value="$vo['logistics_code']">selected</eq>>{$vo.logistics_name}</option>
                        </foreach>
                    </select>
                    订单号:
                    <input type="text" class="form-control" name="refund_shipping_code" style="width: 200px;" value="{$orders_info['refund_shipping_code']}" placeholder="请输入物流订单号...">
                    <button type="submit" class="btn btn-primary js-ajax-submit">更新发货</button>
                    <input type="hidden" name="order_id" value="{$orders_info['order_id']}">
                </form>
            </eq>
        </div>
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>


<script>
    $(function () {
        $('.update_shipping').click(function () {
            var order_id="{$orders_info['order_id']}";
            $.ajax({
                type: "POST",
                url: "/admin/order/update_shipping.html",
                data: {order_id:order_id},
                dataType: "json",
                success: function (data) {
                    window.location.reload();
                }
            })
        })
        $('.return_get').click(function () {
            var order_id="{$orders_info['order_id']}";
            Wind.use("layer", function () {
                <php>if($orders_info['refund_type']==1){</php>
                    var msg='您是否确认收到货物？一旦确认，用户将收到您的退款';
                <php>}else{</php>
                    var msg='您是否确认收到货物？';
                 <php>}</php>
                layer.confirm(msg, {
                    btn: ['是的','不了'] //按钮
                }, function(){
                    $.ajax({
                        type: "POST",
                        url: "/admin/order/edit_status_get.html",
                        data: {order_id:order_id},
                        dataType: "json",
                        success: function (data) {
                            window.location.reload();
                        }
                    })
                }, function(){

                });
            });
        })
        $('.store_yes').click(function () {
            var order_id="{$orders_info['order_id']}";
            Wind.use("layer", function () {
                layer.confirm('您是否同意退换货？', {
                    btn: ['是的','不了'] //按钮
                }, function(){
                    $.ajax({
                        type: "POST",
                        url: "/admin/order/edit_status.html",
                        data: {order_id:order_id},
                        dataType: "json",
                        success: function (data) {
                          window.location.reload();
                        }
                    })
                }, function(){

                });
            });
        })
        $('.store_no').click(function () {
            var order_id="{$orders_info['order_id']}";
            Wind.use("layer", function () {
                layer.open({
                    id:1,
                    type: 1,
                    title:'拒绝理由',
                    area:['80%', 'auto'],
                    content: ' <div class="row" style="width: 100%;">'
                    +'<div>'
                    +'<div>'
                    +'<input type="text" class="refund_no_reason" placeholder="请输入拒绝理由" value="" style="width: 90%;margin-left: 4%;padding-left:1%;border: 1px #eee solid;height: 35px;margin-top: 3%;">'
                    +'</div>'
                    +'</div>'
                    +'</div>'              ,
                    btn:['提交'],
                    btn1: function (index,layero) {
                        var refund_no_reason=$('.refund_no_reason').val();
                        if(refund_no_reason==''){
                            layer.msg('请输入拒绝理由')
                            return;
                        }
                        $.ajax({
                            type: "POST",
                            url:"/admin/order/edit_status.html",
                            data: {
                                "refund_no_reason":refund_no_reason,
                                "order_id":order_id
                            },
                            dataType: "json",
                            success: function (data) {
                                window.location.reload();
                            }
                        })
                    }
                 });
            })
        })
    })
</script>
</body>
</html>